package Eyjafjalla.card.skill;

import Eyjafjalla.action.DrawCloudAction;
import Eyjafjalla.action.MarkHeartAction;
import Eyjafjalla.action.MelodyAction;
import Eyjafjalla.card.AbstractEyjafjallaCard;
import Eyjafjalla.patch.MelodyPatch;
import Eyjafjalla.subscriber.MelodySubscriber;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import com.megacrit.cardcrawl.actions.common.GainEnergyAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;

import java.util.ArrayList;

public class InSunset_Eyjafjalla extends AbstractEyjafjallaCard implements MelodySubscriber {
    public static final String ID = "InSunset_Eyjafjalla";
    private static final CardStrings cardStrings;

    public InSunset_Eyjafjalla(){
        super(ID, cardStrings.NAME,1,cardStrings.DESCRIPTION,CardType.SKILL,CardRarity.UNCOMMON,CardTarget.NONE);
        setFireDescription(cardStrings.EXTENDED_DESCRIPTION[0]);
    }

    @Override
    public AbstractCard makeCopy() {
        return new InSunset_Eyjafjalla();
    }

    public MelodyPatch.MelodySingle getSingle(){
        ArrayList<MelodyPatch.MelodyNote> notes = new ArrayList<>();
        notes.add(new MelodyPatch.MelodyNote(this,0,2,cardStrings.EXTENDED_DESCRIPTION[1]));
        notes.add(new MelodyPatch.MelodyNote(this,1,1,cardStrings.EXTENDED_DESCRIPTION[1]));
        if(upgraded)
            notes.add(new MelodyPatch.MelodyNote(this,2,2,cardStrings.EXTENDED_DESCRIPTION[1]));
        MelodyPatch.MelodySingle single = new MelodyPatch.MelodySingle(this.name,notes,null);
        single.alwaysHeart = true;
        return single;
    }

    @Override
    public ArrayList<AbstractGameAction> getNoteActions(boolean isFinal, int specialAmount) {
        return new ArrayList<>();
    }

    @Override
    public int initializeSpecialAmount(boolean isFinal) {
        return 0;
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new DrawCloudAction(1));
        addToBot(new MelodyAction(getSingle()));
        if(isFire()){
            addToBot(new DrawCardAction(1));
        }
    }

    @Override
    public void upgrade() {
        if(!this.upgraded){
            upgradeName();
            rawDescription = cardStrings.UPGRADE_DESCRIPTION;
            initializeDescription();
        }
    }

    static {
        cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    }
}



